<?php
$screen = Blyn::app()->getUIManager()->getCurrentScreen();
$availableUrl = $control->getLinkUrl(array('name' => 'available','id' => 'booking_list_available'));
$listUrl = $control->getLinkUrl(array('name' => 'list','id' => 'booking_list'));
$myBookingUrl = $control->getLinkUrl(array('name' => 'myBooking','id' => 'booking_list_unpaid'));
?>
<script type="text/javascript">
$( document ).on( "pagecreate", function() {
    $( "#expand" ).click(function() {
        //$("#set").children(":last").toggle();
        $("#search-form").toggle(150);
    });
    $("input[name=radio-choice-h-5]").click(function() {
        var id=$(this).attr('id');
        switch(id) {
            case "radio-choice-h-6a":location.href="<?php echo $availableUrl;?>";break;
            case "radio-choice-h-6b":location.href="<?php echo $listUrl;?>";break;
            case "radio-choice-h-6c":location.href="<?php echo $myBookingUrl;?>";break;
        }
    });
//    $("input[name=radio-choice-h-6]").click(function() {
//        var id=$(this).attr('id');
//        if(id == "radio-choice-h-6c") {
//            $("#search-control-group1").val("-");
//        }
//    })
});
</script>
<style type="text/css">
#nav {width: 100%;/*height: 40px;*/background-color: #80C8EE;}
/*#expand {display: inline !important;}*/
#search-form {background-color: white;border-bottom: 1px solid #dedede;padding-left: 10px;display: none;background-color: #FBFBFB;}
.left-menu {width: 30% !important;}
.right-menu {width: 70% !important;}
.controlgroup-textinput {padding: .22em;width: 255px !important;}
.controlgroup-numinput {padding: .22em;width: 112px !important;}
/*.search-input {width: 500px !important;}*/
.search-btn {padding: .83em;width: 20%;}
legend {margin-bottom: 0px !important;font-size: 15px !important;line-height: 25px !important;border: 0 !important;}
.item {border: 1px solid #dedede; padding: 5px 5px; background-color: white; margin: 5px 1px;}
.img-div {text-align: center;margin-bottom: 4px;padding:0 1px;}
.court-name {font-weight: bold; color:blueviolet;}
.court-price {}
#court-list a {text-decoration: none;color: inherit;font-family: 微软雅黑; font-size: 14px; line-height: 28px;}
form {margin: 0 !important;}
.choice {margin: 0 !important; float:right;}
</style>

<div id="nav">
    <fieldset class="ui-grid-a">
        <div class="ui-block-a left-menu"><a href="#" class="ui-btn ui-icon-search ui-btn-icon-notext ui-corner-all" id="expand" style="margin: 3px 5px;">Search</a></div>
        <div class="ui-block-b right-menu">
            <fieldset data-role="controlgroup" data-type="horizontal" data-mini="true" class="choice">
                <input type="radio" name="radio-choice-h-5" id="radio-choice-h-6a" value="">
                <label for="radio-choice-h-6a">可预订</label>
                <input type="radio" name="radio-choice-h-5" id="radio-choice-h-6b" value="">
                <label for="radio-choice-h-6b">所有场地</label>
                <input type="radio" name="radio-choice-h-5" id="radio-choice-h-6c" value="">
                <label for="radio-choice-h-6c">我的预定</label>
            </fieldset>
        </div>
    </fieldset>
</div>
<div id="search-form">
<?php
    echo CHtml::beginForm();
    $model = new BDynamicFormModel();
    $model->addField('findType');
    $model->addField('findText');
    
    $model->findType = '4';
?>

        <fieldset data-role="controlgroup" data-type="horizontal" data-mini="true">
            <legend>搜索条件:</legend>
            <?php echo CHtml::activeRadioButtonList($model, 'findType', array('1'=>'场地', '2'=>'时间', '3'=>'价格', '4'=>'场地商', '5'=>'场地类型'), array('template'=>'{input}
{label}','separator'=>" ")); ?>
        </fieldset>
        <div style="width:100%;height:1px;"></div>
        <fieldset data-role="controlgroup" data-type="horizontal" data-mini="true" id="search-opration">
            <?php echo CHtml::activeSearchField($model, 'findText', array('data-wrapper-class'=>'controlgroup-textinput ui-btn')); ?>
            <button class="search-btn" onclick='javascript:void(searchIt())'>搜索</button>
            <?php echo $screen->getAjaxLink('searchByVender', array('htmlOptions' => array('id'=>'searchLink', 'style'=>'display:none'))); ?>
        </fieldset>
<?php echo CHtml::endForm(); ?>
</div>
<script>
function searchIt() {
    $("#searchLink").click();
    return false;
}
</script>
